<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>008-HTML5-Canvas-文本-实心</title>
</head>

<body>
    <canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;">
        您的浏览器不支持 HTML5 canvas 标签。</canvas>

    <script>

        var c = document.getElementById("myCanvas");
        var ctx = c.getContext("2d");
        ctx.font = "30px Arial"; // font - 定义字体
        ctx.fillText("Hello World", 10, 50); // fillText(text,x,y) - 在 canvas 上绘制实心的文本
        // strokeText(text,x,y) - 在 canvas 上绘制空心的文本

    </script>
</body>

</html>